home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15764 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.infi.net!usenet
  2. From: Scott Hightower <hightowr@lex.infi.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: what does this code do?
  5. Date: Sat, 06 Apr 1996 20:59:25 -0500
  6. Organization: InfiNet
  7. Message-ID: <3167217D.AC7@lex.infi.net>
  8. References: <4k6u2v$i2c@newsbf02.news.aol.com>
  9. NNTP-Posting-Host: h-adenoma.lex.infi.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. Mrdavc wrote:
  16. > linePtrs[currentLine][lineLen[currentLine]] = (char) key;
  17. > What does this code do?  It looks like linePtrs is a multidimensional
  18. > array but its not defined that way.  is both linePtrs[currentLine] and
  19. > lineLen[currentLine] set to (char) key??
  20. > example from Teach yourself Turbo C++ 4.5 for Windows by Craig Arnush
  21. > p,355
  22.  
  23. Sorry, don't have the book avail to confirm this, but sounds like linePtrs
  24. is an array of pointers to lines, which are themselves char[].  And
  25. currentLine is an index into the array of pointers and another array of
  26. lengths for each line.  So if currentLine=1423, and lineLen[1423]=64,
  27. key is cast to char and placed at index 64 of the char array pointed to
  28. by linePtrs[1423].  And then probably lineLen[1423] is incremented.
  29.  
  30.